<?php

class MailboxPeer extends BaseMailboxPeer
{
	
	static function getCountMessage($from_id, $to_id)
	{
		$c = new Criteria();
		$c->add(MailboxPeer::FROM_ID,$from_id);
		$c->addand(MailboxPeer::TO_ID,$to_id);
		$c->addAnd(MailboxPeer::PUB,true);
		$c->addAnd(MailboxPeer::DEL_RESIVER,false);
		$cnt = MailboxPeer::doCount($c);
		return $cnt;
		
	}

        static function getNewMessages()
	{
            $c = new Criteria();
            $c->add(MailboxPeer::TO_ID,sfContext::getInstance()->getUser()->getAttribute( 'user_id', null, 'sfGuardSecurityUser' ));
            $c->add(MailboxPeer::PUB, true);
            $c->add(MailboxPeer::FL_READ, false);
            $c->add(MailboxPeer::DEL_RESIVER, false);
            $cnt = MailboxPeer::doCount($c);
            return $cnt;
        }
	
}
